package com.example.workshop.lesson11;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

@Component
public class ContentBasedFilter implements Filter {
    //@Override

   // private Filter filter;
    private Logger logger=
            LoggerFactory.getLogger(this.getClass());

    public ContentBasedFilter(){

        super();
        logger.info("ContentBasedFilter construct method");

    }

    @PostConstruct
    public  void postConstruct(){
        //初始化代码放这里
        logger.info("In ContentBasedFilter postConstruct method");
    }

    @PreDestroy
    public  void preDestroy(){
        //缓存中清理电影
        logger.info("In ContentBasedFilter preDestroy method");
    }

    public String[] getRecommendations(String movie) {
        //计算相似度
        //放回电影推荐
        return new String[]{"火星救援","星球大战","星际穿越"};

    }
}
